// page/mine/pages/partner/partner.js
var app = getApp()
var that;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    userimg: wx.getStorageSync("bizUserInfo").wxHeadimg,
    wxNickName: wx.getStorageSync("bizUserInfo").wxNickNameStr,
    partner: [],
    // referee:'',
    awablesumktx: '',
    awalssumytx: '',
    tjpeople2: false,
    tjpeople1: true,
    partnerdata: {},
    teamdata: '',
    companyName:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    that = this
    that.setData({
      companyName: wx.getStorageSync('companyName')
    })
    wx.request({
      url: app.api.distpartnerinfo() + `?memberId=${wx.getStorageSync("bizUserInfo").id}`,
      success: function(res) {
        console.log(res.data.data)
        wx.setStorageSync('qrCode', res.data.data)
        that.setData({
          partnerdata: res.data.data
        })
        if (res.data.data.referee == null) {
          that.setData({
            tjpeople1: true,
            tjpeople2: false
          })
        } else {
          that.setData({
            tjpeople1: false,
            tjpeople2: true
          })
        }
      }
    })
    wx.request({
      url: app.api.distributionTeamNum() + `?pid=${wx.getStorageSync("bizUserInfo").id}`,
      success: function(res) {
        console.log(res.data.data)
        that.setData({
          teamdata: res.data.data
        })
      }

    })
  },
  shareEwM() {
    wx.navigateTo({
      url: '/page/mine/pages/erweima/erweima',
    })
  },
  jumpTX() {
    wx.navigateTo({
      url: '/page/mine/pages/tixian/tixian',
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})